package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsDbInterface;
import com.ruoyi.system.service.IWmsDbInterfaceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 中间表参数Controller
 * 
 * @author ZYT
 * @date 2020-08-28
 */
@RestController
@RequestMapping("/system/WmsDbInterface")
public class WmsDbInterfaceController extends BaseController
{
    @Autowired
    private IWmsDbInterfaceService wmsDbInterfaceService;

    /**
     * 查询中间表参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:list')")
    @GetMapping("/list")
    public TableDataInfo list(WmsDbInterface wmsDbInterface)
    {
        startPage();
        List<WmsDbInterface> list = wmsDbInterfaceService.selectWmsDbInterfaceList(wmsDbInterface);
        return getDataTable(list);
    }

    /**
     * 导出中间表参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:export')")
    @Log(title = "中间表参数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WmsDbInterface wmsDbInterface)
    {
        List<WmsDbInterface> list = wmsDbInterfaceService.selectWmsDbInterfaceList(wmsDbInterface);
        ExcelUtil<WmsDbInterface> util = new ExcelUtil<WmsDbInterface>(WmsDbInterface.class);
        return util.exportExcel(list, "WmsDbInterface");
    }

    /**
     * 获取中间表参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wmsDbInterfaceService.selectWmsDbInterfaceById(id));
    }

    /**
     * 新增中间表参数
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:add')")
    @Log(title = "中间表参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WmsDbInterface wmsDbInterface)
    {
        return toAjax(wmsDbInterfaceService.insertWmsDbInterface(wmsDbInterface));
    }

    /**
     * 修改中间表参数
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:edit')")
    @Log(title = "中间表参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WmsDbInterface wmsDbInterface)
    {
        return toAjax(wmsDbInterfaceService.updateWmsDbInterface(wmsDbInterface));
    }

    /**
     * 删除中间表参数
     */
    @PreAuthorize("@ss.hasPermi('system:WmsDbInterface:remove')")
    @Log(title = "中间表参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsDbInterfaceService.deleteWmsDbInterfaceByIds(ids));
    }
}
